@extends('admin.public')

@section('content')
    @if((bool)\Auth::guard('admin')->user()->is_root)
        <div class="col-md-12">
            <section class="panel panel-default text-sm doc-buttons">
                <div class="panel-body">
                    <a href="{{ route('admin.index.admin_add') }}" class="btn btn-info"><i class="icon-plus ico"></i>
                        &nbsp; 添加管理员</a>
                </div>
            </section>
        </div>
    @endif

    <div class="col-md-12">
        @foreach($admins as $admin)
            <section class="panel panel-default">
                <header class="panel-heading bg-light no-border">
                    <div class="clearfix">
                        <div class="clear">
                            <div class="h3 m-t-xs m-b-xs">
                                {{ $admin->name }}
                                @if( (int)\Auth::guard('admin')->user()->is_root )
                                    @if( !(int)$admin->is_root )
                                        <a href="{{ route('admin.index.admin') }}?del={{ $admin->id }}"
                                           class="btn btn-xs btn-danger pull-right m-l">删除</a>
                                    @endif
                                    <a href="{{ route('admin.index.admin_edit',$admin->id) }}"
                                       class="btn btn-xs btn-default pull-right">编辑</a>
                                @endif
                            </div>
                            <small class="text-muted">
                                {{ (bool)$admin->is_root? '超级管理员' : '普通管理员' }}
                                @if(!empty( $admin->login_at ))
                                    最后登录:{{ $admin->login_at }}
                                @endif
                            </small>
                        </div>
                    </div>
                </header>
            </section>
        @endforeach
    </div>
@endsection

@section('js')
@endsection